<template>
  <div>
    <Row class="home-page-content" align="middle">
      <BtnPlain class="com-action-btn" type="primary" @click="goBack">返回</BtnPlain>
      <h3>经营信息预警详情</h3>
    </Row>

    <div class="home-page-content business-Info">
      <Row justify="space-between" align="middle" v-if="type === 'feedback'">
        <Row align="middle">
          <BtnPlain class="com-action-btn" type="primary">{{ info.feedbackPhaseName }}</BtnPlain>
          <span>反馈倒计时</span>
          <Countdown :time="info.feedbackForewarningEndDate" />
        </Row>
        <div class="publisher">
          <span>经营人员 {{ info.busiPersonName || '--' }}</span>
          <span>最后反馈时间 {{ info.feedbackDate || '--'}}</span>
        </div>
      </Row>
      <Row justify="space-between" align="middle" v-if="type === 'receive'">
        <Row align="middle">
          <BtnPlain class="com-action-btn" :type="info.acceptStatus | getAcceptStatus">{{ info.acceptStatusName }}</BtnPlain>
          <span>接收倒计时</span>
          <Countdown :time="info.receiveForewarningEndDate" />
        </Row>
        <div class="publisher">
          <span>发布人 {{ info.publisher || '--' }}</span>
          <span>发布时间 {{ info.publishTime || '--'}}</span>
        </div>
      </Row>
      <Row class="mt-20">
        <h3>{{ info.projectName }}</h3>
      </Row>

      <!-- 接收情况 -->
      <ReceiveList
        v-if="type === 'receive'"
        :showFeedback="false"
        :showTime="false"
        :busiIndustryAssignList="info.busiIndustryAssignVoList"
      />

      <!-- 反馈 -->
      <Feedback v-if="type === 'feedback'" showTitle :feedbackDetailVoList="info.feedbackVoList" />
    </div>
  </div>
</template>

<script>
import Feedback from '@/pages/businessInformationManage/common/feedback.vue'
import Countdown from '@/pages/businessInformationManage/common/countdown.vue'
import ReceiveList from '@/pages/businessInformationManage/common/receiveList.vue'
import { getNotReceiveDetail, getNotFeedbackDetail } from '@/api/businessInformationManage.js'

export default {
  name: "businessInfoWarningDetails",
  components: { Feedback, Countdown, ReceiveList },
  data () {
    return {
      info: {},
      type: ''
    };
  },
  created () {
    const { busInfoForewarningId, type } = this.$route.query
    this.type = type
    if (type === 'receive') {
      this.getReceiveData(busInfoForewarningId)
      return
    }
    this.getFeedback(busInfoForewarningId)
  },
  methods: {
    async getFeedback (busInfoForewarningId) {
      this.info = await getNotFeedbackDetail({ busInfoForewarningId })
      this.info.feedbackVoList = this.info.busiIndustryAssignVoList[0].feedbackVoList

    },
    async getReceiveData (busInfoForewarningId) {
      this.info = await getNotReceiveDetail({ busInfoForewarningId })
    },
    goBack () {
      this.$router.replace({ path: '/businessInformationWarning' });
    }
  },
}
</script>

<style lang='less' scoped>
.business-Info {
  margin-top: 20px;
}

.publisher {
  > span {
    margin-left: 20px;
  }
}

.mt-20 {
  margin-top: 20px;
}

.ml-20 {
  margin-left: 20px;
}
</style>
